package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.base.PageResponse;
import com.zzyl.entity.NursingProject;
import com.zzyl.vo.NursingProjectVo;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface NursingProjectMapper {

    // 根据id查询护理项目
    @Select("SELECT * FROM nursing_project WHERE id = #{id}")
    NursingProjectVo selectById(Long id);

    // 分页查询所有护理项目
    Page<NursingProjectVo> selectByPage(@Param("name") String name, @Param("status") Integer status);

    // 新增护理项目
    @Insert("INSERT INTO nursing_project (name, order_no, unit, price, image, nursing_requirement, status, create_by, update_by, remark, create_time, update_time)\n" +
            "    VALUES (#{name}, #{orderNo}, #{unit}, #{price}, #{image}, #{nursingRequirement}, #{status}, #{createBy}, #{updateBy}, #{remark}, #{createTime}, #{updateTime})\n")
    void insert(NursingProject nursingProject);

    // 更新护理项目

    void update(NursingProject nursingProject);

    // 删除护理项目
    @Delete("DELETE FROM nursing_project WHERE id = #{id}")
    void delete(Long id);

    @Update("UPDATE nursing_project SET status = #{status} WHERE id = #{id}")
    void updateStatus(Long id, Integer status);
}
